package base.src;

import game.base.BaseButton;
import game.base.BaseCanvas;
import game.base.UIButtonClick;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.view.MotionEvent;
import android.view.View;

public class MenuScreen extends BaseCanvas
{
	Paint defaultPaint;
	int changeScreenTime;
	BaseButton play;	
	BaseButton options;
	public MenuScreen(BatalhaNavalActivity _activity)
	{
		super(_activity);
		defaultPaint = new Paint();
		play = new BaseButton(new Point((Properties.getScreenSize().x-Images.buttonPlayMenu.getWidth())/2,300), Images.buttonPlayMenu,Images.buttonPlayMenuOn);
		play.setActionClick(new UIButtonClick() {
			@Override
			public void performActionClick(MotionEvent event) {
				getGame().changeScreen(new GameScreen(getBaseActivity()));
			}
		});
		options = new BaseButton(new Point((Properties.getScreenSize().x - Images.buttonOptionsMenu.getWidth()) / 2, 400),
				Images.buttonOptionsMenu, Images.buttonOptionsMenuOn);
		options.setActionClick(new UIButtonClick() {
			
			@Override
			public void performActionClick(MotionEvent event) {
				getGame().changeScreen(new OptionsScreen(getBaseActivity()));
			}
		});
		changeScreenTime = 0;
	}
	

	@Override
	public void onDraw(Canvas canvas)
	{
		canvas.drawBitmap(Images.logoMenuImg.getImage(), (Properties.getScreenSize().x-Images.logoMenuImg.getWidth())/2, 0, defaultPaint);
		play.draw(canvas);
		options.draw(canvas);
	}

	@Override
	public void onUpdate(long difftime)
	{
		play.update(difftime);
		options.update(difftime);
	}

	@Override
	public void onSensorChanged(SensorEvent event)
	{
		
		
	}

	@Override
	public boolean onTouchEvent(MotionEvent event)
	{
		play.eventHandler(event);
		options.eventHandler(event);
		return false;
	}

	@Override
	public void onAccuracyChanged(Sensor sensor, int accuracy)
	{
	}

	@Override
	public boolean onTouch(View v, MotionEvent event)
	{
		return false;
	}

}
